package mongo.db.clients.firsts;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Date;
import java.util.Random;
import java.util.concurrent.Callable;

import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.MongoClient;

public class SpeedTest implements Callable<Integer> {
	
	int count;

/*	public static void main(String[] args) throws Exception {
		SpeedTest test = new SpeedTest();
		test.call();
	}*/
	
	
	public SpeedTest(int count) {
		super();
		this.count = count;
	}







	@Override
	public Integer call() throws Exception {
		
		System.out.println("thread : " + count);
		
		MongoClient	client = new MongoClient("202.191.136.234", 27017);
		
		DB db = client.getDB("netflowdb");
		DBCollection collection = db.getCollection("uniques");
			Random rn = new Random();

				for (int i = 0; i < 10000; i++) {
					collection.insert(new BasicDBObject("dim0",rn.nextInt(100000)));
				}
	return 1;
	}
	

}
